<template>
  <div>
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/index' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>系统中心</el-breadcrumb-item>
      <el-breadcrumb-item>用户管理</el-breadcrumb-item>
      <el-breadcrumb-item>投资方管理</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card>
      <el-row>
        <el-form :model="userForm" label-width="70px">
          <el-col :span="5">
            <el-form-item label="姓名">
              <el-input v-model="userForm.fullName"></el-input>
            </el-form-item>
          </el-col>
<!--          <el-col :span="5">-->
<!--            <el-form-item label="入职日期">-->
<!--              <el-date-picker type="date" placeholder="选择日期" v-model="userForm.startDate" style="width: 100%;"></el-date-picker>-->
<!--            </el-form-item>-->
<!--          </el-col>-->
<!--          <el-col :span="5">-->
<!--            <el-form-item label="——">-->
<!--              <el-date-picker type="date" placeholder="选择日期" v-model="userForm.endDate" style="width: 100%;"></el-date-picker>-->
<!--            </el-form-item>-->
<!--          </el-col>-->
        </el-form>
        <el-button type="info" plain @click="sel01()">搜索</el-button>
      </el-row>
      <!--    <el-button type="primary" @click="centerDialogVisible = true">添加用户</el-button>-->
      <!--    <el-button type="primary"  @click="importExcelVisible = true">导入</el-button>-->
      <!--    <el-button type="primary"  @click="excelout">导出</el-button>-->

      <el-table
        :data="list01"
        style="width: 100%">
        <el-table-column
          align="center"
          prop="id"
          label="编号">
        </el-table-column>
        <el-table-column
          align="center"
          prop="tel"
          label="手机号">
        </el-table-column>
        <el-table-column
          align="center"
          prop="authStatus"
          label="是否认证（0:未实名认证 1:已实名认证）">
          <template slot-scope="scope">
            {{scope.row.authStatus==0?"未实名认证":"已实名认证"}}
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          prop="fullName"
          label="姓名">
        </el-table-column>
        <el-table-column
          align="center"
          prop="idNum"
          label="身份证号">
        </el-table-column>
        <el-table-column
          align="center"
          prop="nickName"
          label="昵称">
        </el-table-column>
        <el-table-column
          align="center"
          prop="email"
          label="邮箱">
        </el-table-column>
        <el-table-column
          align="center"
          prop="balance"
          label="平台账户的余额">
        </el-table-column>
        <el-table-column
          align="center"
          prop="bank"
          label="开户行">
        </el-table-column>
        <el-table-column
          align="center"
          prop="account"
          label="账号">
        </el-table-column>
        <el-table-column
          align="center"
          prop="status"
          label="状态(0禁用 1启用)">
          <template slot-scope="scope">
            {{scope.row.authStatus==0?"禁用":"启用"}}
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          prop="regTime"
          label="注册时间">
          <template slot-scope="scope">
            {{scope.row.regTime | datefmt('YYYY-MM-DD HH:mm:ss')}}
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          prop="loginPwd"
          label="登录密码">
        </el-table-column>
        <el-table-column
          align="center"
          prop="tokenPwd"
          label="提现密码">
        </el-table-column>
        <el-table-column
          align="center"
          prop="lastLoginTime"
          label="最后登录时间">
          <template slot-scope="scope">
            {{scope.row.lastLoginTime | datefmt('YYYY-MM-DD HH:mm:ss')}}
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          prop="source"
          label="0:注册 1:管理员新增">
          <template slot-scope="scope">
            {{scope.row.source==0?"注册":"管理员新增"}}
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          prop="recoTel"
          label="推荐人手机号">
        </el-table-column>
        <el-table-column
          align="center"
          label="操作">
          <template slot-scope="scope">
            <el-dropdown size="mini" split-button type="primary" trigger="click">
              操作
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item @click.native="update(scope.row.id,1)" v-if="scope.row.authStatus==0">启用</el-dropdown-item>
                <el-dropdown-item @click.native="update(scope.row.id,0)" v-if="scope.row.authStatus==1">禁用</el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </template>
        </el-table-column>
      </el-table>

      <el-pagination
        align="center"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="page.pagenum"
        :page-sizes="[5, 10, 15, 20]"
        :page-size="page.pagesize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total">
      </el-pagination>
    </el-card>
<!--    {{list01}}{{total}}-->
  </div>
</template>

<script>
  export default {
    name: "Investuser",
    data(){
      return{
        page:{
          pagenum:0,
          pagesize:5
        },
        userForm:{},
        list01:[],//投资方集合
        total:null
      }
    },
    methods:{
      handleSizeChange:function (val) {
        this.page.pagesize=val;
        this.sel01();
      },
      handleCurrentChange:function (val) {
        this.page.pagenum=val;
        this.sel01();
      },
      sel01:function() {//查询投资方的数据
        this.$http.post("/finance-service-user/investor/list"+"/"+this.page.pagenum+"/"+this.page.pagesize,this.userForm).then(res=>{
          // debugger
          this.list01=res.data.result.list;
          this.total=res.data.result.total;
        })
      },
      update:function (id,val) {//状态修改
        this.$http.post("/finance-service-user/investor/update/"+id+"/"+val).then(res=>{
          if(res.data.success){
            this.$message({
              message:res.data.message,
              type: 'success'
            });
            this.sel01();
          }else{
            this.$message.error(res.data.message);
          }
        })
      }
    },
    mounted() {
      this.sel01();
    },
    filters: {

    }
  }
</script>

<style scoped>

</style>
